#include <cstdio>
#include <bitset>
#include <ctime>
#include <cstdlib>
using namespace std;

int main_10()
{
    srand((unsigned)time(0));
    bitset<20> a=0x7faec;
    printf("%s\n",a.to_string().c_str());
    //a[5]=1;
    a.set(5);
    unsigned long index=rand()%a.size();
    if (a[index])
    {
        printf("%lu true\n",index);
    }else
    {
        printf("%lu false\n",index);
    }
    unsigned long b=a.to_ulong();
    printf("%lu\n",b);
    printf("%s\n",a.to_string().c_str());
    size_t bits=a.count();
    printf("%llu ones %llu\n bits",bits,a.size());
    bool is_set=a.any();
    if (is_set)
    {
        printf("There exists one!\n");
    }
    else
    {
        printf("There doesn't exist one!\n");
    }
    a.reset();
    bool is_not_set=a.none();
    if (is_not_set)
    {
        printf("There are all zeros.\n");
    }
    else
    {
        printf("There aren't all zeros.\n");
    }
	return 0;
}
